draw2d.Figure.prototype.createCommand=function(/*:draw2d.EditPolicy*/ request)
{
  if(request.getPolicy() == draw2d.EditPolicy.MOVE)
  {
    if(!this.canDrag)
      return null;
      
      
    return new draw2d.CommandMove(this);
  }

  if(request.getPolicy() == draw2d.EditPolicy.DELETE)
  {
  
    if(!this.isDeleteable())
       return null;
  alert("del");
    gateDeleted(this);
    return new draw2d.CommandDelete(this)
  }
  return null;
}

draw2d.Connection.prototype.createCommand=function(/*:draw2d.EditPolicy*/ request)
{
  if(request.getPolicy() == draw2d.EditPolicy.MOVE)
  {
    // DragDrop of a connection doesn't create a undo command at this point. This will be done in
    return new draw2d.CommandReconnect(this);
  }
  if(request.getPolicy() == draw2d.EditPolicy.DELETE)
  {
    if(this.isDeleteable()==true) {
      connectionDeleted(this);
      return new draw2d.CommandDelete(this);
    }  
    return null;
  }

  return null;
}

draw2d.CommandDelete.prototype.execute=function()
{
   this.redo();
}

draw2d.CommandReconnect.prototype.setNewPorts=function(/*:draw2d.Port*/ source, /*:draw2d.Port*/ target)
{
  this.newSourcePort = source;
  this.newTargetPort = target;
  connectionChanged(this);
  //connectionChanged(oldSourcePort.getId(), oldTargetPort.getId(), source.getId() , target.getId());
}
